#============================================================
#    Texture Utils
#============================================================
# - datetime: 2022-08-31 22:59:25
#============================================================

##  图片工具类。根据图片名称获取对应图片
class_name TextureUtils


const TEXTURE_PATH_MAP := {}


#============================================================
#  自定义
#============================================================
##  获取图片
##[br]
##[br][code]texture_name[/code]  图片名称
static func get_texture(texture_path: String, texture_name: String, default:Texture=null) -> Texture:
	var path := texture_path.path_join(texture_name)
	if TEXTURE_PATH_MAP.has(path):
		return TEXTURE_PATH_MAP[path] as Texture
	else:
		if FileAccess.file_exists(path):
			var texture := load(path) as Texture
			TEXTURE_PATH_MAP[path] = texture
			return texture
		else:
			return default

